<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>用户登录</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <link href="https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/css/font-awesome.min.css" rel="stylesheet">
</head>
<body class="bg-gray-100 min-h-screen flex items-center justify-center p-4">
    <div class="w-full max-w-md bg-white rounded-lg shadow-md overflow-hidden">
        <div class="bg-blue-500 text-white p-6">
            <h2 class="text-2xl font-bold text-center">
                <i class="fa fa-sign-in mr-2"></i>用户登录
            </h2>
        </div>
        <div class="p-6">
            {% with messages = get_flashed_messages() %}
                {% if messages %}
                    {% for message in messages %}
                    <div class="bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded mb-4">
                        <i class="fa fa-exclamation-circle mr-2"></i>{{ message }}
                    </div>
                    {% endfor %}
                {% endif %}
            {% endwith %}
            
            <form method="POST" action="/login">
                <div class="mb-4">
                    <label for="username" class="block text-gray-700 mb-2">
                        <i class="fa fa-user mr-2"></i>用户名
                    </label>
                    <input type="text" id="username" name="username" required
                        class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500">
                </div>
                
                <div class="mb-6">
                    <label for="password" class="block text-gray-700 mb-2">
                        <i class="fa fa-lock mr-2"></i>密码
                    </label>
                    <input type="password" id="password" name="password" required
                        class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500">
                </div>
                
                <button type="submit" 
                    class="w-full bg-blue-500 hover:bg-blue-600 text-white font-bold py-2 px-4 rounded-md transition duration-200">
                    <i class="fa fa-sign-in mr-2"></i>登录
                </button>
            </form>
            
            <div class="mt-6 pt-4 border-t border-gray-200 text-center">
                <p class="text-gray-600">还没有账号？ <a href="/register" class="text-blue-500 hover:text-blue-700">
                    <i class="fa fa-user-plus mr-1"></i>注册账号
                </a></p>
            </div>
        </div>
    </div>
</body>
</html>
